﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace TuongLai_Schools
{
    public  class clsSysObject
    {
        public cls_ObjectCollection Getlist_Object()
        {
            cls_ObjectCollection sysObjectCollection = new cls_ObjectCollection();
            DbAccess db = new DbAccess();
            db.CreateNewSqlCommand_Text();
            SqlDataReader reader = db.ExecuteReader("Select ObjectID,ObjectName,ObjectNote from sysObject");
            while (reader.Read())
            {
                sysObject obj_Object = new sysObject();
                obj_Object.ObjectID = (int)reader["ObjectID"];
                obj_Object.ObjectName = reader["ObjectName"].ToString();
                obj_Object.ObjectNote = reader["ObjectNote"].ToString();
                sysObjectCollection.Add(obj_Object);
            }
            reader.Close();
            return sysObjectCollection;
        }
        public DataTable GetAll_Object()
        {
            DbAccess db = new DbAccess();
            db.CreateNewSqlCommand_Text();
            DataTable dataTable = db.ExecuteDataTable("Select ObjectID,ObjectName,ObjectNote from sysObject");
            return dataTable;
        }
    }
}
